package day13.edu;

// Created: 13/09/2025, ChangJiang Ru
public class WindowTest {
    public static void main(String[] args) {


        SaleTicket s = new SaleTicket();

        Thread t1 = new Thread(s);
        Thread t2 = new Thread(s);
        Thread t3 = new Thread(s);

        t1.start();
        t2.start();
        t3.start();
    }
}

class SaleTicket implements Runnable
{
    int ticket = 100;

    @Override
    public void run() {
        while(true)
        {
            if(ticket > 0) {
                System.out.println(Thread.currentThread().getName() + " have sale, the ticket is : " + ticket);
                ticket--;
            }
            else
                break;
        }
    }
}
